Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vue-app): middleware not executing on double browser back navigation #6775

Merged
merged 8 commits into from
Mar 13, 2020

Conversation

jsonpoindexter
Copy link

@jsonpoindexter jsonpoindexter commented Dec 9, 2019

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

When a Nuxt app is in Universal mode it is possible that in some cases a component's middleware does not execute.
This can happen when a user first navigates to a project page (example: Page B), server.js executes and then before client.js executes the user navigates to another page in the project (example: Page A). In this scenario https://github.com/nuxt/nuxt.js/blob/dev/packages/vue-app/template/client.js#L810 will evaluate to TRUE and not execute the middleware(s) for page A.

Resolves: https://cmty.app/nuxt/nuxt.js/issues/c10049 / #6716

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
    I could not find a way to programmatically reproduce this issue ie. changes routes after server.js has executed, but before client.js executes.
  • All new and existing tests are passing.

@jsonpoindexter jsonpoindexter changed the title Middleware not executing on double browser back navigation fix(template): middleware not executing on double browser back navigation Dec 9, 2019
@codecov-io
Copy link

codecov-io commented Dec 9, 2019

Codecov Report

Merging #6775 into dev will decrease coverage by 0.07%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #6775      +/-   ##
==========================================
- Coverage   64.82%   64.75%   -0.08%     
==========================================
  Files          78       78              
  Lines        2718     2721       +3     
  Branches      706      708       +2     
==========================================
  Hits         1762     1762              
- Misses        729      730       +1     
- Partials      227      229       +2
Flag Coverage Δ
#e2e 100% <ø> (?)
#unit 64.75% <0%> (-0.08%) ⬇️
Impacted Files Coverage Δ
packages/vue-renderer/src/renderers/ssr.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46385de...d470422. Read the comment docs.

@Atinux Atinux requested review from pi0 and clarkdo December 16, 2019 12:06
@Atinux
Copy link
Member

Atinux commented Dec 16, 2019

Actually this makes sense, even if I cannot reproduce it on my machine (might be too fast).

Can you reproduce this on your slower machine when running nuxt start?

@jsonpoindexter
Copy link
Author

@Atinux yes, I am able to reproduce this in production mode.

jeremybradbury
jeremybradbury previously approved these changes Dec 18, 2019
@Atinux Atinux changed the title fix(template): middleware not executing on double browser back navigation fix(vue-app): middleware not executing on double browser back navigation Dec 19, 2019
# Conflicts:
#	packages/vue-app/template/server.js
@pi0 pi0 merged commit 1f5d489 into nuxt:dev Mar 13, 2020
@pi0
Copy link
Member

pi0 commented Mar 13, 2020

Thanks @jsonpoindexter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants